﻿using HotelManager.DAL;
using HotelManager.Model;

namespace HotelManager.BLL
{
    public  class RoomManager
    {
        private readonly IRoomService _roomService;
        public RoomManager(IRoomService roomService)
        {
            _roomService = roomService;
        }

        /// <summary>
        /// 获取房间信息
        /// </summary>
        /// <returns></returns>
        public  List<RoomBusiness> GetRoomInfo(int roomId)
        {
            return _roomService.GetRoomInfo(roomId);
        }

        /// <summary>
        /// 删除房间信息
        /// </summary>
        /// <param name="roomId"></param>
        /// <returns></returns>
        public  bool DelRoomInfo(int roomId)
        {
            return _roomService.DelRoomInfo(roomId) == 1 ? true : false;
        }

        /// <summary>
        /// 添加房间信息
        /// </summary>
        /// <param name="room"></param>
        /// <returns></returns>
        public  bool AddRoomInfo(RoomBusiness room)
        {
            return _roomService.AddRoomInfo(room) == 1 ? true : false;
        }


        /// <summary>
        /// 更新房间信息
        /// </summary>
        /// <param name="room"></param>
        /// <returns></returns>
        public  bool UpdateRoomInfo(RoomBusiness room)
        {
            return _roomService.UpdateRoomInfo(room) == 1 ? true : false;
        }

        /// <summary>
        /// 查询未入住房间
        /// </summary>
        /// <returns></returns>
        public  List<Room> FreeRoom()
        {
            return _roomService.GetFreeRoom();
        }


        /// <summary>
        /// 获取所有房间类型信息
        /// </summary>
        /// <returns></returns>
        public  List<RoomType> GetAllRoomType()
        {
            return _roomService.GetAllRoomType();
        }

        /// <summary>
        /// 根据房间类型查询房间状态
        /// </summary>
        /// <param name="typeId"></param>
        /// <returns></returns>
        public  List<Room> GetRoomStateByType(int typeId)
        {
            return _roomService.GetRoomStateByType(typeId);
        }

        /// <summary>
        /// 查询所有房间状态
        /// </summary>
        /// <returns></returns>
        public  List<Room> GetRoomState()
        {
            return _roomService.GetRoomState();
        }

        /// <summary>
        /// 查询房间数
        /// </summary>
        /// <returns></returns>
        public  int GetRoomCount(int typeId)
        {
            return _roomService.GetRoomCount(typeId);
        }

        /// <summary>
        /// 根据状态ID查询房间数
        /// </summary>
        /// <param name="stateId"></param>
        /// <returns></returns>
        public  int GetRoomStateCount(int stateId,int typeId)
        {
            return _roomService.GetRoomStateCount(stateId,typeId);
        }
    }
}
